package org.jeecg.common.util;

import java.math.BigDecimal;

/**
 * @author guoyh
 * @ClassName AmountUtils
 * @Description
 * @since 2020/8/29 02:33
 **/
public class AmountUtils {

    public static BigDecimal fenToYuan(long amount){
        BigDecimal bigDecimal = new BigDecimal(amount);
        return bigDecimal.divide(new BigDecimal(100)).setScale(2,BigDecimal.ROUND_HALF_DOWN);
    }

    public static long yuanToFen(BigDecimal amount){
        return amount.multiply(new BigDecimal(100)).longValue();
    }
}
